import {BANNER, NEWARRIVAL} from '../constants/home'

const INITIAL_STATE = {
  banners: [],
  newArrival: []
}

export default function home(state = INITIAL_STATE, action) {
  switch (action.type) {
    case BANNER: {
      const {list} = action.payload
      return {...state, banners: list ? list : []}
    }
    case NEWARRIVAL: {
      const {list} = action.payload
      return {...state, newArrival: list}
    }
    default:
      return state
  }
}
